// BbsLayer.h: interface for the CBbsLayer class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_BBSLAYER_H__005715B8_F548_4ED7_8739_990C8A6D338C__INCLUDED_)
#define AFX_BBSLAYER_H__005715B8_F548_4ED7_8739_990C8A6D338C__INCLUDED_

#include "TelnetLayer.h"
#include "AnsiScreen.h"
#include "IVirtualKeyboard.h"
#include "IVirtualMouseEvents.h"
#include "BbsStateCollection.h"
#include "MouseSensitiveCollection.h"

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// check last changecounter diff from screen.changecount
// if yes, update state

class CBbsLayer : public IVirtualMouseEvents, public IAppIdleListener
{
protected:
	CTelnetLayer *m_pTelnetLayer;
	CAnsiScreen *m_pScreen;
	CBbsStateCollection m_stateCol;
	CPoint m_lastCursorCell;
	CMouseSensitiveCollection m_mouseSensitiveCol;
	BOOL m_bMouseFreezed;

public:
	virtual void OnAppIdle();

public:
	virtual BOOL OnMouseDown(CPoint ptCell, UINT nFlags);
	virtual BOOL OnMouseMove(CPoint ptCell, UINT nFlags);
	virtual BOOL OnMouseUp(CPoint ptCell, UINT nFlags);
	virtual BOOL OnMouseWheel(CPoint ptCell, UINT nFlags, short wheelNotches);

	virtual BOOL OnFreezeMouse(BOOL bFreeze);
	
protected:
	int m_screenChangeCounter;
	void updateState();

public:
	CBbsLayer(CTelnetLayer *pTelnetLayer, CAnsiScreen *pScreen, IVirtualKeyboard *pKeyboard);
	virtual ~CBbsLayer();

};

#endif // !defined(AFX_BBSLAYER_H__005715B8_F548_4ED7_8739_990C8A6D338C__INCLUDED_)
